﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WorkStation.Frameworks.EasyBus.Pipeline.Filters;

namespace WorkStation.Frameworks.EasyBus.Pipeline.Handles
{
    /// <summary>
    /// 处理器接口
    /// </summary>
    public interface IHandle
    {
        /// <summary>
        /// 处理器唯一标识
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// 过滤器
        /// </summary>
        IFilter Filter { get; set; }

        /// <summary>
        /// 顺序
        /// </summary>
        int Order { get; set; }

        /// <summary>
        /// 处理
        /// </summary>
        /// <param name="context">执行上下文</param>
        /// <returns></returns>
        HandleResult Execute(ActionContext context);

        /// <summary>
        /// 注册处理内容
        /// </summary>
        /// <param name="func">委托</param>
        /// <returns></returns>
        IHandle RegisterHandle(Func<ActionContext, IHandle, HandleResult> func);
    }
}
